var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (im.getServerName().equals("BMS单机") && im.getServerName().equals("BMS至尊体验服") && !im.getServerName().equals("BMS至尊")) {
        im.playerMessage(1, " 使用环境异常，请还原服务端配置。");
        im.dispose();
        return
    }
    if (status == 0 && d == 0) {
        im.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        im.dispose()
    } else {
        if (status === a++) {
            im.askMenu("就是我发明的水战机器人！#r#e无敌的机甲海马#n#k。\r\n选择你心仪的机甲海马吧。\r\n#b#L0# #i2630917:# #t2630917# #k#l\r\n#b#L1# #i2630918:# #t2630918# #k#l\r\n#b#L2# #i2630919:# #t2630919# #k#l\r\n", 4, 9062208)
        } else {
            if (status === a++) {
                im.askYesNo("\r\n确定要领取#b#e#i" + (2630917 + selectionLog[1]) + ":# #t" + (2630917 + selectionLog[1]) + "##k#n吗？", 4, 9062208)
            } else {
                if (status === a++) {
                    im.sendNormalTalk("机甲海马已发放，请确认。", 5, 9062208, false, false);
                    im.gainItem(2630917 + selectionLog[1], 1);
                    im.gainItem(2630916, -1)
                } else {
                    if (status === a++) {
                        im.dispose()
                    }
                }
            }
        }
    }
};